<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
</head>

<body>
    <script>
        class Navbar {
            init() {
                console.log("navbar-init")
            }

            getData() {
                console.log("navbar-getData")
                return new Promise((resolve) => {
                    setTimeout(() => {
                        resolve("navbar-1111")
                    }, 1000)
                })
            }

            render() {
                console.log("navbar-render")
            }
        }



        class List {
            init() {
                console.log("List-init")
            }

            getData() {
                console.log("List-getData")
                return new Promise((resolve) => {
                    setTimeout(() => {
                        resolve("list-1111")
                    }, 1000)
                })
            }

            render() {
                console.log("List-render")
            }
        }


        class Creator {
            async startBuild(builder) {
                await builder.init()
                let res = await builder.getData()
                console.log(res)
                await builder.render()
            }
        }


        const op = new Creator()
        op.startBuild(new Navbar())
        op.startBuild(new List())
    </script>
</body>

</html>